import {Injectable} from '@angular/core';
import {ToastController} from "ionic-angular";

@Injectable()
export class ToastService {
    constructor(public toastCtrl: ToastController) {
    }

    /**
     * 显示Toast
     * @param {string} message 提示消息
     * @param time 提示停留时间
     */
    showToast(message: string,time?) {
        this.toastCtrl.create({
            message: message,
            duration: time || 1200,
            position: 'middle',
        }).present();
    }
}
